# Forked from Alpine for qmi voicecall support & smdpkt patches

pkgname=ofono
pkgver=9999
_pkgver=1.31
pkgrel=7
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications [$_pkgver]"
url="https://01.org/ofono"
arch="armhf armv7 aarch64"
license="GPL-2.0-only"
depends="bluez mobile-broadband-provider-info"
makedepends="glib-dev dbus-dev ell-dev eudev-dev
	linux-headers bsd-compat-headers libexecinfo-dev
	autoconf automake libtool"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc $pkgname-scripts::noarch"
source="https://www.kernel.org/pub/linux/network/ofono/ofono-$_pkgver.tar.xz
	fix-explicit-bzero.patch
	fix-TEMP_FAILURE_RETRY.patch
	skip-broken-test.patch
	support-smdpkt.patch
	0001-common-create-GList-helper-ofono_call_compare.patch
	0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
	0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch
	0004-add-call-list-helper-to-manage-voice-call-lists.patch
	0005-qmimodem-implement-voice-calls.patch
	0006-qmimodem-Fix-dialing-to-an-international-number.patch
	$pkgname.initd
	$pkgname-auto-enable.initd
	udev.rules
	ofono-wheel.conf"
builddir="$srcdir/$pkgname-$_pkgver"

# Workaround build freeze with QEMU user emulation
export JOBS=1
export MAKEFLAGS=-j$JOBS

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/sbin \
		--enable-external-ell \
		--enable-tools \
		--enable-test
	make
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 tools/auto-enable "$pkgdir"/usr/bin/ofono-auto-enable
	install -Dm644 plugins/ofono.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono.rules
	install -Dm644 "$srcdir"/udev.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono-pmos.rules
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm755 "$srcdir"/$pkgname-auto-enable.initd "$pkgdir"/etc/init.d/$pkgname-auto-enable
	install -Dm755 "$srcdir"/ofono-wheel.conf "$pkgdir"/etc/dbus-1/system.d/
}

scripts() {
	pkgdesc="$pkgdesc (test scripts)"
	depends="python3 py3-dbus py3-gobject3"

	amove usr/lib/ofono/test
}

sha512sums="377cda34dcc92d1f339a4b3271de5a14afaf309061c4467e5af18089cd821e65c0d8ad29d07e96d0f0480bb51554b284afb6bc2b9da586cc30dc0c1440612b20  ofono-1.31.tar.xz
7367464a8983969c9a78c1e4f8759a17eb47f6c61c94b088d749c83bb7ef5d19e037cadedd7ef5d34a0fdfe837fa8059e963f4fb2b14148e4a80f00e7cb29286  fix-explicit-bzero.patch
687a2fd592add40122b789073ab9970d6e966752fdecc4077afe1c1bba705fe541dd0e457094f1d9cde747c571b7810b5b1a30835a3f1869bcd810751d5bf76f  fix-TEMP_FAILURE_RETRY.patch
777ab2e13eebd1ccbe12a304310a83b262a5d934207c6a8d410e75aff380838eed1a52f3c2fe0d80c1e7db7faa9b55bf17e78a1e1acd8cfb95a3c6aef49c5b67  skip-broken-test.patch
f7f398f77877e78087b691f78ee0f3af5f99d0f15d01d107fbefff16118db4c1e0261c032bd97836a6c30d8b8a4be9d755900c5f9ea48d274a53d9c39c92683b  support-smdpkt.patch
ad25dcc34bf710287c9a03fdcd61f2f2fd675691f55be30dbe7c8421753aa857906dd23b2d4f7f752fbc62caf2857b00bf5eaa8916e62718d1da7d0abc083ca0  0001-common-create-GList-helper-ofono_call_compare.patch
7e2f7fb1e661cc9f2180c55c701823050328ee906171148e4ba200e6365f1c40382dab608e78e383e62c9029a6a41d7d7a18b971132df30839f625eb576cb080  0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
1a55f558c2e3058eee7dae2a60538417ae0fc058f322f4740a0f46a080cc2fda2c8a8cd522d243ab8f0be2ea461ad7dc1c27d2e73bcaac5848d9c592d6386d8a  0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch
3e0dce12bcb65d3c6db15cfd50058e793bf1f1ae6e330bf804565afde54614227746a8d4316ccd36093f22e2cc4f62e3a32e46276ab81a7b1f3a61f56984ed78  0004-add-call-list-helper-to-manage-voice-call-lists.patch
72d0f63c091d4b1fc5b405ec67e73f377887ee3dffd4791272122462bf4feaeec207de9b177632756e1f973a7bf7bde119c6ec6556568a6307287ba43998b7a0  0005-qmimodem-implement-voice-calls.patch
6dd4d5f829d66b5b9a13aed6d5a991a2cd3dee6db04a122bcc1d87d0eddc37637468bec58f9fe6027c89eac3b14411201d324150e6be4b103622340da6a599fe  0006-qmimodem-Fix-dialing-to-an-international-number.patch
bc76c404a7de626210dbd78f659444567a95b6e6d8db0661d5d67ea361e2941ad55242d43a5957995817145d4d5323476fbc42d1830b20608a5e90a7a4ba1194  ofono.initd
54a2cb55547e77c22a98c4260f2e94d9327d5d98e1b604f9413a7380ae4489247a97561cc2ab39476bc6e6fb5e673dca8053218b18ac4626addb51ecb29f0167  ofono-auto-enable.initd
28ba914e171ba7f0dcc4be24f2bd078a8db6b2c0fdbb29845b2702f00f9cf64d0e9ecb277e5d7f8113ef450eb9044e542e7093129ecd67bef1c9e9328756391c  udev.rules
72cd0cd4bee1f885a990c84f7ed3ef27e0d9d2db37d9a486342204152cb02a67d5197e8014dfea59f1a95285c674695b3dc3cb2b53941781bcfc9b73d5580b1f  ofono-wheel.conf"
